package com.theta.gateway.infra.common.utils;

import java.io.UnsupportedEncodingException;

import org.springframework.util.Base64Utils;

import lombok.extern.slf4j.Slf4j;


@Slf4j
public class Base64Util {
	
	private static final String CHARSET_NAME="UTF-8";
	
	
	public static String encode2Str(String str) {
		if(str==null || "".equals(str))return "";
		try {
			return Base64Utils.encodeToString(str.getBytes(CHARSET_NAME));
		} catch (UnsupportedEncodingException e) {
			log.warn("",e);
		}
		return "";
	}
	
	

}
